package com.neusoft.yuejian_01.model;

import com.neusoft.yuejian_01.base.BaseModel;
import com.neusoft.yuejian_01.javabean.NewsBean;
import com.neusoft.yuejian_01.listener.RetrofitListener;
import com.neusoft.yuejian_01.service.NewsService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by MARIA on 2017/10/13.
 */

public class MyNewsModel extends BaseModel {
    //所有奖品列表
    public void getMyNewslist(final RetrofitListener listener) {
        this.flag = Const.MeNewsList;
        NewsService newsService = retrofit.create(NewsService.class);
        Call<List<NewsBean>> call = newsService.getMyNewslist();
        Callback<List<NewsBean>> callback = new Callback<List<NewsBean>>() {
            @Override
            public void onResponse(Call<List<NewsBean>> call, Response<List<NewsBean>> response) {
                List<NewsBean> news = response.body();
                listener.onSuccess(news,flag);
            }
            @Override
            public void onFailure(Call<List<NewsBean>> call, Throwable t) {
                listener.onFail();
            }
        };
        call.enqueue(callback);
    }






}
